import axios from "axios";

//设置基础url地址


//获取benzhou信息

export const getInfo = data =>
    axios({
        url: "/api/book/by-categories?type=hot&major=玄幻",
        method: "get",
        data
    });
//获取xianxia信息
export const getxianxiaInfo = data =>
    axios({
        url: "/api/book/by-categories?type=hot&major=仙侠",
        method: "get",
        data
    });

//获取dushi信息
export const getdushiInfo = data =>
    axios({
        url: "/api/book/by-categories?major=都市",
        method: "get",
        data
    });
//获取kehuan信息
export const getkehuanInfo = data =>
    axios({
        url: "/api/book/by-categories?type=hot&major=科幻",
        method: "get",
        data
    });
//获取zhichang信息
export const getzhichangInfo = data =>
    axios({
        url: "/api/book/by-categories?type=hot&major=职场",
        method: "get",
        data
    });
//获取zhichang信息
export const getqihuanInfo = data =>
    axios({
        url: "/api/book/by-categories?type=hot&major=奇幻",
        method: "get",
        data
    });

//axios拦截器 拦截请求
// axios.interceptors.request.use(function(config) {
//     const token = localStorage.getItem("qftoken");

//     //获取的请求接口，如果是登录或者是注册那就没有必要写token
//     const api = config.url;
//     if (api === "/users/login" || api === "users/register") {
//         console.log(config);
//         return config;
//     } else {
//         config.headers["authorization"] = token;
//         return config;
//     }
// });

// //axios拦截响应
// axios.interceptors.response.use(function(config) {
//     console.log(config);
//     if (!config.data.state && config.data.msg == "校验失败") {
//         alert("用户信息过期请重新登录");
//         location.href = "#/login";
//         localStorage.removeItem("qftoken");
//         return config;
//     } else {
//         return config;
//     }
// });

//登录
// export const login = data =>
//     axios({
//         url: "/users/login",
//         method: "post",
//         data,
//         timeout: 5000
//     });

//获取学员信息
// export const getstulist = (params = {}) =>
//     axios({
//         method: "get",
//         url: "/students/getstulist",
//         params
//     });

//获取登陆日志

// export const getlog = () => axios.get("/getloginlog");
